//需要拦截器的地方使用instance对象， 有自定义返回逻辑的地方沿用axios，在组件内部处理返回结果即可
import request from '/@/utils/request';
export default function () {
    /**
     * 获取数据
     *
     */
    const queryRecord = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/SettlementBill/QueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 通用-结算订单导出Excel
     * @param params 要传的参数值
     * @returns 返回Excel文件
     */
    const exportCommonSettlementExcel = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/SettlementBill/CommonSettlementBillExportExcel",
            method: "post",
            headers: { 'Content-Type': 'application/json-patch+json' },
            data: params,
            responseType: 'blob'
        });
    };

    /**
     * 导出Excel文件
     * @param params 要传的参数值
     * @returns 返回Excel文件
     */
    const exportExcel = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/SettlementBill/ExportExcel",
            method: "post",
            headers: { 'Content-Type': 'application/json-patch+json' },
            data: params,
            responseType: 'blob'
        });
    };

    /**
     * 导出渠道Excel文件
     * @param params 要传的参数值
     * @returns 返回Excel文件
     */
    const exportChannelExcel = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/SettlementBill/ExportChannelExcel",
            method: "post",
            headers: { 'Content-Type': 'application/json-patch+json' },
            data: params,
            responseType: 'blob'
        });
    };

    /**
     * 获取商户结算数据
     * @param params 要传的参数值
     */
    const queryProductSettlementRecord = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/SettlementBill/QueryProductSettlementPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 通用-结算订单查询
     * @param params 要传的参数值
     */
    const queryCommonSettlementRecord = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/SettlementBill/QueryCommonSettlementPage",
            method: "post",
            data: params,
        });
    };

    return {
        queryCommonSettlementRecord,
        exportCommonSettlementExcel,

        exportExcel,
        exportChannelExcel,
        queryRecord,
        queryProductSettlementRecord
    };
}
